/*
 *  Copyright 2005 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.persistence.forum;

import com.blandware.atleap.model.forum.Post;
import com.blandware.atleap.model.forum.Topic;
import com.blandware.atleap.persistence.core.PageDAO;
import com.blandware.atleap.common.util.PartialCollection;
import com.blandware.atleap.common.util.QueryInfo;

/**
 * <p>DAO for posts.</p>
 * <p><a href="PostDAO.java.html"><i>View source</i></a></p>
 *
 * @author Roman Puchkovskiy <a href="mailto:roman.puchkovskiy@blandware.com">
 *         &lt;roman.puchkovskiy@blandware.com&gt;</a>
 * @version $Revision: 1.3 $ $Date: 2006/06/16 15:21:24 $
 */
public interface PostDAO extends PageDAO {

    // ~ CRUD Methods ================================================================

    /**
     * Creates a post in a given topic.
     *
     * @param post post to create
     * @param topic topic in which to create post
     * @return post ID
     */
    public Long createPost(Post post, Topic topic);

    /**
     * Retrieves a post by its ID.
     *
     * @param postId ID of post to retrieve
     * @return found post
     */
    public Post retrievePost(Long postId);

    /**
     * Updates a post.
     *
     * @param post post to be updated
     * @param topic topic to which post belongs
     */
    public void updatePost(Post post, Topic topic);

    /**
     * Updates a post leaving its topic unchanged.
     *
     * @param post post to be updated
     */
    public void updatePost(Post post);

    /**
     * Deletes a given post.
     *
     * @param post post to delete
     */
    public void deletePost(Post post);

    // ~ Additional methods ================================================================

    /**
     * Retrieves filtered/sorted collection of posts
     *
     * @param queryInfo Object that contains information about how to filter
     * and sort data
     * @return Collection of posts
     */
    public PartialCollection listPosts(QueryInfo queryInfo);
}
